<extend name="Public/base"/>

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>手机认证</h2>
	</div>

    <div class="cf">
        <div class="fl">

        </div>
        <button class="btn get_allinfo" >一键获取</button>

        <a class="btn"style="float:left" href="index.php?m=admin&c=authentication&a=mobile_add">新增</a>

        <php>
            $QIANBAO_AUTH_STATUS = C('QIANBAO_AUTH_STATUS');
            $status = I('get.status','');
        </php>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">

            <div class="sleft">

                <div class="drop-down" style="width: 150px;">
                    <if condition="$status eq ''">
                        <span id="sch-sort-txt"  style="width: 115px;" class="sort-txt" data="">所有</span>
                        <else/>
                        <span id="sch-sort-txt"  style="width: 115px;" class="sort-txt" data="{$status}">{$QIANBAO_AUTH_STATUS[$status]}</span>
                    </if>


                    <i class="arrow arrow-down"></i>
                    <ul id="sub-sch-menu" class="nav-list hidden">
                        <li><a href="javascript:;" style="width: 115px;" value="">所有</a></li>
                        <foreach name="QIANBAO_AUTH_STATUS" item="vo" >
                            <li><a href="javascript:;" style="width: 115px;" value="{$key}">{$vo}</a></li>
                        </foreach>
                    </ul>
                </div>
                <input name="title" class="search-input" value="{:I('get.title','')}" placeholder="请输入手机号码、用户UID" type="text">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('mobile')}"><i class="btn-search"></i></a>
            </div>

        </div>
    </div>
	<!-- 数据列表 -->
	<div class="data-table">
	<table class="">
    <thead>
        <tr>

		<th class="">用户UID</th>
		<th class="">真实姓名</th>
		<th class="">手机号码</th>
		<th class="">身份证号</th>
		<th class="">地址</th>
		<th class="">注册时间</th>
         <th class="">状态</th>
		<th style="width: 150px;" class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>

			<td >{$vo.uid} </td>
			<td>{$vo.name}</td>
			<td>{$vo.mobile}</td>
			<td>{$vo.idCard}</td>
            <td>{$vo.address}</td>
			<td>{$vo.register}</td>
            <td>{:C('QIANBAO_AUTH_STATUS.'.$vo[status])}</td>
			<td u="{$vo.uid}">
                <if condition="$vo[status] eq -1">
                    <button class="ajax-get get_data" style="background:#fff;border:none;color:#2d7200;cursor:pointer;">获取数据</button>
                    <!-- <a class="ajax-get" href="{:U('getinfo?type=mobile&id='.$vo['uid'])}">获取数据</a> -->
                    &nbsp;&nbsp;
                <else/>
                    <a class="ajax-get" href="{:U('change?type=mobile&method=2&id='.$vo['uid'])}">通过</a>
                    &nbsp;&nbsp;
                    <a class="ajax-get" href="{:U('change?type=mobile&method=3&id='.$vo['uid'])}">不通过</a>
                    &nbsp;&nbsp;
                </if>

                <a href="{:U('mobileview?id='.$vo['uid'])}">详细</a>
                </td>
		</tr>
		</volist>
		<else/>
		<td colspan="8" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
	<!-- 分页 -->
	<div class="page">{$_page}</div>
	<!-- /分页 -->

</block>
<block name="script">
<script type="text/javascript">
    highlight_subnav('{:U('Authentication/mobile')}');
    $(function(){
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var status = $("#sch-sort-txt").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(status != ''){
                query += '&status=' + status + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });

        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down").hover(function(){
            $("#sub-sch-menu").removeClass("hidden");
        },function(){
            $("#sub-sch-menu").addClass("hidden");
        });
        $("#sub-sch-menu li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu").addClass("hidden");
            })
        });



        $('.get_data').click(function(){
            var uid=$(this).parents().attr('u');
            var type='mobile';
            $.ajax({
                type:'post',
                data:{'uid':uid,'type':type},
                // dataType:'json',
                url:"{:U('getinfo?')}",
                success:function(m){
                    // console.log(m);
                    alert(m);
                    location.reload();
                }
            })
        })



        $('.get_allinfo').click(function(){
            $.ajax({
                type:'get',
                url:"{:U('get_allinfo')}",
                success:function(m){
                    alert(m)
                    location.reload();
                }
            })

        })


    })

</script>
</block>
